package com.bb.blog.security.model;

import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.provider.client.BaseClientDetails;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;


// todo clientId使用mybatis <selectKey>标签自动生成

/**
 * 自定义客户端详情
 */

public class BbClientDetails extends BaseClientDetails {

    private String name;
    private Integer status;
    private Date createTime;

    public void setAuthorities(List<String> authorities){
        this.setAuthorities(authorities.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList()));
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
